#include <stdio.h>

int main(void)
{
	int x = 0;
	scanf_s("%d", &x);

	int a, b, c, d;
	a = x % 10;
	b = x / 10 % 10;
	c = x / 10 / 10 % 10;
	d = x / 10 / 10 / 10 % 10;
	
	int y = 0;

	y = a * 1000 + b * 100 + c * 10 + d;

	printf("%d", y);



	return 0;
}